package com.eam.service;

import com.yy.base.common.dao.Dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class EquipmentinformationCheckService {
	@Autowired
	private Dao dao;

//	//查询所有工序
//	public Map<String, Object> initProcessReportInfo() {
//		Map<String,Object> map = new HashMap<String,Object>();
//		List<Map<String,Object>> processList = dao.query("select name from Emes_ProcessOpr");
//		
//		map.put("processList", processList);
//		System.out.println("11");
//		return map;
//	}
	//查询所有工序
	public List<Map<String, Object>> initProcessReportInfo() {
		int aa = 1;
		return dao.query("select name  from Emes_ProcessOpr where 1 = ?" , aa);
	}

	//查询所有设备的运行状态s
	public List<Map<String, Object>> searchProcessReport() {
		return dao.query("select sb.code as SBCODE , max(decode(cjdz.dataquality, 'abnormal', 2, 'fault', 3, 1)) as CJSSTATUS,gx.name AS GXNAME"
				+ " from emes_facilities sb , Emes_Equipment_Working  gxgl ,Emes_Fancilities_Dc_Point cjd,Emes_Fancilities_Dc_value cjdz, Emes_ProcessOpr gx "
				+ " where sb.emes_facilities_id = gxgl.emes_facilities_id "
				+ " and sb.emes_facilities_id = cjd.emes_facilities_id "
				+ "and cjdz.emes_fancilities_dc_point_id = cjd.emes_fancilities_dc_point_id "
				+ "and gx.emes_processopr_id = gxgl.emes_processopr_id "
				+ "group by sb.code ,gx.name  ");
	}

	
	//查询设备关联的工序
		public List<Map<String, Object>> countsProcessopr() {
			return dao.query("select  DISTINCT  xxx.name  as GXNAME "
					+ "from Emes_Equipment_Working www "
					+ " left join emes_processopr xxx on xxx.emes_processopr_id = www.emes_processopr_id ");
		}
	
	
	public List<Map<String, Object>> searchProcessInQtyReport(String processId, String manuDate) {
		List<Object> params = new ArrayList<Object>();
		String sql = " ";
		return dao.query(sql, params.toArray());
	}
}
